<?php $this->load->view('common/header');?>
<?php echo wap_js_url('dialog');?>
<?php echo wap_js_url('mobile-select-area');?>
<?php echo wap_css_url('mobile-select-area');?>
<body class="padding_top">
<!-- head [[-->
<div class="head_box">
	<div class="bank_nav">
        <a href="<?php echo site_url('member');?>"><i class="ico"></i></a>
    </div>
    <div class="head_title">新增收货地址</div>
</div>
<!--]] head -->
<!-- info [[-->
<div class="submit_form">
    <form action="<?php echo site_url('member/updatedress');?>" method="post" id="from1" >
        <?php echo csrf_hidden();?>
        <ul>
            <li>
        	<span class="input">
            	<input placeholder="收件人" type="text" name="dress_uname" id="dress_uname"/>
            </span>
            </li>
            <li>
        	<span class="input" type="text" >
            	<input placeholder="手机号码" name="dress_utel" id="dress_utel">
            </span>
            </li>
            <li>
            <span class="input" >
                    <input placeholder="选择省市区" type="text" id="txt_area4"/>
                    <input type="hidden" id="hd_area" value="" name="hd_area"/>
                </span>

            </li>
            <li>
        	<span class="input">
            	<input placeholder="详细地址/门牌号" id="dress_udress" name="dress_udress" >
            </span>
            </li>
            <li>
                <a href="#" class="sure_nav" id="subForm1">
                    <!-- <input type="submit" > -->
                    确定
                </a>
            </li>
        </ul>
    </form>
</div>
<script>
    var json = <?php echo $this->config->item('cityjson'); ?>;
    var selectArea = new MobileSelectArea();
    selectArea.init({trigger:$('#txt_area4'),value:$('#hd_area').val(),data: json, default: 0, position: "bottom" });
</script>
<script type="text/javascript">
    $("#subForm1").click(function () {
        var dress_uname = document.getElementById("dress_uname").value;
        var dress_utel = document.getElementById("dress_utel").value;
        var dress_udress = document.getElementById("dress_udress").value;
        var dress_citys = document.getElementById("txt_area4").value;

        if(dress_uname == "" ){
            layer.msg("收件人姓名不能为空！");
            return false;
        }
        // var reg = /^[\u4E00-\u9FA5]{4,60}$/;
        if(dress_uname.length<2 || dress_uname.length>20){
            layer.msg("收件人姓名输入有误请重新输入！");
            return false;
        }

        if(dress_utel == ""  ){
            layer.msg("收件人电话不能为空！");
            return false;
        }
        var  re = /^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/;
        if(re.test(dress_utel)) {      //判断字符是否是11位数字

        }else{
            layer.msg("手机号码格式错误!");
            return false;
        }
        if(dress_udress == "" ){
            layer.msg("详细地址不能为空！");
            return false;
        }
        if(dress_udress.length<4 || dress_udress.length>20){
            layer.msg("收件人详细地址输入有误请重新输入！");
            return false;
        }
        if(dress_citys == ""){
            layer.msg("所在省市必须选择！");
            return false;
        }
        $("#from1").submit();
    });

</script>
<!--]] info -->
</body>
</html>
